<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="demo.css" media="screen,projection" />
<title>Entity mention set extraction</title>
</head>
<body>
<?
//<meta http-equiv="content-type" content="text/html; charset=utf-8">
include_once "prerequisite.php";
include_once "ems_extraction.php";

$query_text = $_REQUEST[query_text];
$query_dic = $_REQUEST[query_dic];

if ( $query_text == "" && $query_dic == "" ) {
	$query_text = "We have recently demonstrated that stimulation of human T and natural killer cell";
	$query_dic = "T, T cell, cell proliferation, demonstrated graft infiltration, human, human T and B cell, human T cell, human T cell line, human and mouse gene, human cell, human natural killer cell, human natural killer cell, killer cell, killer cell, natural killer, natural killer cell, natural killer cell, stimulation";
}
?>
<p>&nbsp;</p>
<h2>Entity mention set extraction</h2>
<p>&nbsp;</p>
<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
<p><strong><u>Text</u></strong></p>
<p><textarea name="query_text" cols="100" rows="4"><?=$query_text?></textarea>
</p>
<p><strong><u>Dictionary</u></strong></p>
<p><textarea name="query_dic" cols="100" rows="4"><?=$query_dic?></textarea>
</p>
<p><input type="submit" name="Submit" value="Submit"></p>
</form>
<p>&nbsp;</p>
<?
if ( $query_text != "" && $query_dic != "" ) {

	$allowed_coordinator = array();
	$allowed_coordinator['and'] = true;
	$allowed_coordinator['or'] = true;
	$allowed_coordinator[','] = true;
	$allowed_coordinator[', and'] = true;
	$allowed_coordinator[', or'] = true;
	
	$token_array = tokenize_string($query_text);

	$str_val_list = array();
	foreach ( explode(",", $query_dic) as $str ) {
		$str = trim($str);
		$str_val_list[$str] = true;
	}
	$trie = make_trie($str_val_list, array());

	$result_ner = extract_entity_mention_set($token_array, $trie, array(
		'verbose'=>true,
		'max_candidate_length'=>32,
		'max_candidate_ref'=>512,
		'max_apriori_level'=>12,
		'max_apriori_candidate'=>128,
		'support_uniqueness'=>true,
		'allowed_coordinator'=>$allowed_coordinator));
}
?>
<p>&nbsp;</p>
</body>
</html>
